package com.sap;

import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoParameterList;

public class CheckSnFromSAP {
	public static void main(String[] args) {
		JCoFunction function = null;
		JCoDestination destination = SAPConn.connect();
		int result = 0;// 调用接口返回状态
		String message = "";// 调用接口返回信息
		try {
			// 调用ZCHENH001函数
			function = destination.getRepository().getFunction("ZCHENH001");
			JCoParameterList input = function.getImportParameterList();
			input.setValue("P1", 10);
			input.setValue("P2", 2);
			input.setValue("OPERATOR", "?"); // 输入参数
			function.execute(destination);
			result = function.getExportParameterList().getInt("RESULT");// 调用接口返回结果
			message = function.getExportParameterList().getString("MSG");// 调用接口返回信息
			System.out.println("调用返回结果--->" + result + ";调用返回状态--->" + message);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
